package com.liang.consumer;

import com.liang.config.ConfirmConfig;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: XIAOLIANG
 * Date: 2021/6/19
 * Time: 18:27
 * Description: 报警队列的消费者
 */
@Component
@Slf4j
public class WarningConsumer {


    //接受消息
    @RabbitListener(queues = ConfirmConfig.WARN_QUEUE_NAME)
    public void receiveQueue(Message message, Channel channel) throws UnsupportedEncodingException {

        String msg = new String(message.getBody(), StandardCharsets.UTF_8);

        log.error("报警发现不可路由的消息:{}",new String(message.getBody()));


    }

}